home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77665_nicglobal_prop.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  54.8 KB  |  1,729 lines

  1. <%@Language=VBScript%>
  2. <%Option Explicit%>
  3. <%
  4.     '-------------------------------------------------------------------------
  5.     'nicglobal_prop.asp:    Configure network settings that apply to all network adapters
  6.     '                        on the server appliance.
  7.     '
  8.     ' Copyright (c) Microsoft Corporation.  All rights reserved. 
  9.     '
  10.     ' Date            Description
  11.     '15-01-2001        Created date
  12.     '05-03-2001        Modified date
  13.     '-------------------------------------------------------------------------
  14. %>
  15.     <!-- #include virtual="/admin/inc_framework.asp"-->
  16.     <!-- #include file="inc_network.asp"     -->
  17.     <!-- #include file="nicglobal_loc.asp" -->
  18. <%
  19.     '-------------------------------------------------------------------------
  20.     ' Global Variables and Constants
  21.     '-------------------------------------------------------------------------
  22.     Dim page                        'Variable that receives the output page object when
  23.                                     'creating a page 
  24.     
  25.     Dim G_objService                'WMI server object
  26.     Dim G_objRegistry                'Registry object.Value is assigned by calling function regConnection
  27.     
  28.     Dim g_iTabDNS                    'variable for DNS Resolution Tab
  29.     Dim g_iTabTCP                    'variable for TCP/IP Hosts Tab
  30.     Dim g_iTabLMHosts                'variable for NetBIOS LMHOSTS Tab
  31.     Dim g_iTabIPX                    'variable for IPX Settings Tab
  32.         
  33.     'Constants for Registry paths                                   
  34.     Const CONST_DNSREGISTEREDADAPTERSPATH         = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
  35.     Const CONST_DNSREGISTRYENABLELMHOSTSPATH     = "SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
  36.     Const CONST_NETBIOSREGISTRYENABLELMHOSTSPATH = "SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters"
  37.     Const CONST_DRIVERSETCHOSTS                     = "\drivers\etc\hosts"
  38.     Const CONST_DRIVERSETCLMHOSTS                 = "\drivers\etc\lmhosts"
  39.         
  40.         
  41.     
  42.     'Constant for highest unsigned integer value.  This is used to convert signed integer to unsigned integer 
  43.     Const UNSIGNEDINT_FORMATTER = 4294967296
  44.     'Max suffixes allowed is 20 (0 to 19)
  45.     Const MAX_DNS_SUFFIXES = 19
  46.             
  47.     Dim SOURCE_FILE
  48.     SOURCE_FILE = SA_GetScriptFileName()
  49.         
  50.     '-------------------------------------------------------------------------
  51.     ' Form Variables
  52.     '-------------------------------------------------------------------------
  53.     
  54.     Dim F_strLMHOSTS                'value of the LMHost file lookup.
  55.     Dim F_strLMHOSTSLOOKUPSTATUS    'Status of LMHOSTS checkbox
  56.     Dim F_strLMHOSTS_EDITSTATUS     'value of edit status of the LMHost file.    
  57.     Dim F_strLMHOSTSLOOKUP            'value of LMHOSTS checkbox
  58.     Dim F_nNICIndex                    'variable to save which instance of the 
  59.                                     'Win32_NetworkAdapterConfiguration is the IP enabled.    
  60.     
  61.     Dim F_strIPXSettings            'value of IPX settings(True/False)
  62.     Dim F_strIPXVirtualNumber        'value of IPX Virtual Network number
  63.     
  64.     Dim F_strDNSSUFFIX                'DNS Suffixes radio button to use 
  65.     Dim F_strAPPENDDNSSUFFIX        'Append parent suffixes of primary DNS suffix option check box 
  66.     Dim F_strDNSsuffixes            'concatenated - list of DNS suffixes         
  67.     Dim F_strDomainSuffix            'Domain Suffix Name to be added                        
  68.     
  69.     Dim F_strTCPHostData            'To assign the contents of TCP/IP Hosts file
  70.     
  71.     Dim F_strPrimaryChecked             'value of primary DNS suffix Radio button
  72.     Dim F_strPrimaryAndParentChecked 'value of parent suffixes of primary DNS suffix Radio button
  73.     Dim F_strDNSSuffixesChecked         'value of specific DNS suffixes Radio button
  74.     Dim F_strAppendDNSSuffix_EditStatus 'value of parent suffixes of primary DNS suffix Check box
  75.  
  76.     '-------------------------------------------------------------------------
  77.     ' Entry point
  78.     '-------------------------------------------------------------------------
  79.     
  80.     ' Check to see if IPX is installed
  81.     Call GetInitialValues
  82.     
  83.     
  84.     '
  85.     ' Create Tabbed Property Page
  86.     Call SA_CreatePage( L_PAGETITLE, "", PT_TABBED, page )
  87.  
  88.     Call SA_AddTabPage(page, L_DNS_RESOLUTION_TEXT, g_iTabDNS)
  89.     Call SA_AddTabPage(page, L_TCP_HOSTS_TEXT , g_iTabTCP)
  90.     Call SA_AddTabPage(page, L_NETBIOS_LMHOSTS_TEXT, g_iTabLMHosts)
  91.     
  92.     if F_strIPXSettings Then
  93.         Call SA_AddTabPage(page, L_IPX_SETTINGS_TEXT , g_iTabIPX)
  94.     End IF
  95.         
  96.     '
  97.     ' Serve the page
  98.     Call SA_ShowPage( page )
  99.  
  100.     '-------------------------------------------------------------------------
  101.     'Function:                OnInitPage()
  102.     'Description:            Called to signal first time processing for this page.
  103.     'Input Variables:        PageIn,EventArg
  104.     'Output Variables:        PageIn,EventArg
  105.     'Returns:                True/False
  106.     'Global Variables:        None
  107.     '-------------------------------------------------------------------------    
  108.     Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  109.         
  110.         'To get the initial settings for DNS, and IPX from the system
  111.         Call GetInitialValues
  112.         
  113.         'To get the LMHosts and Hosts file contents
  114.         Call GetLMHostsandTCPFileData
  115.         
  116.         'Set the status of Checkbox and Textarea for LMHosts depending on the initial values
  117.         Call SetLMHostStatus()
  118.             
  119.         Call SA_TraceOut(SOURCE_FILE, "OnInitPage")
  120.         
  121.         OnInitPage = TRUE
  122.             
  123.     End Function
  124.  
  125.     
  126.     '---------------------------------------------------------------------------------
  127.     'Function:            OnServeTabbedPropertyPage
  128.     'Description:        Called when the page needs to be served.    
  129.     'Input Variables:    PageIn,EventArg,iTab,bIsVisible
  130.     'Output Variables:    PageIn,EventArg
  131.     'Returns:            TRUE to indicate no problems occured. FALSE to indicate errors.
  132.     '                    Returning FALSE will cause the page to be abandoned.
  133.     'Global Variables:    g_iTabDNS,g_iTabTCP,g_iTabLMHosts,g_iTabIPX    
  134.     '----------------------------------------------------------------------------------
  135.     
  136.     Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  137.                                                     ByVal iTab, _
  138.                                                     ByVal bIsVisible, ByRef EventArg)
  139.             
  140.         Call SA_TraceOut(SOURCE_FILE, "OnServeTabbedPropertyPage")
  141.         
  142.         Select Case iTab
  143.         
  144.             Case g_iTabDNS
  145.                 Call ServeTabDNS(PageIn, bIsVisible)
  146.             Case  g_iTabTCP
  147.                 Call ServeTabTCP(PageIn, bIsVisible)
  148.             Case  g_iTabLMHosts    
  149.                 Call ServeTabLMHosts(PageIn, bIsVisible)
  150.             Case  g_iTabIPX
  151.                 If F_strIPXSettings Then
  152.                     Call ServeTabIPX(PageIn, bIsVisible)     
  153.                 End If
  154.             Case Else
  155.                 'Nothing            
  156.         End Select
  157.             
  158.         OnServeTabbedPropertyPage = TRUE
  159.         
  160.     End Function
  161.  
  162.  
  163.     '-------------------------------------------------------------------------
  164.     'Function:                OnPostBackPage()
  165.     'Description:            Called to signal that the page has been posted-back.
  166.     'Input Variables:        PageIn,EventArg
  167.     'Output Variables:        PageIn,EventArg
  168.     'Returns:                Always return TRUE
  169.     'Global Variables:        F_(*)
  170.     '-------------------------------------------------------------------------
  171.     
  172.     Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  173.         
  174.         Call SA_TraceOut("nicglobal_prop.asp", "OnPostBackPage")
  175.         
  176.         'Updating the variable for LMHosts
  177.         F_strLMHOSTSLOOKUP =    Request.Form("chkLMHOSTSLOOKUP")
  178.         F_strLMHOSTS_EDITSTATUS = Request.Form("hdnLMHOSTS")
  179.         
  180.         'Get the value from txaLMHosts when it is enabled
  181.         F_strLMHOSTS = Request.Form("txaLMHOSTS")
  182.         
  183.                 
  184.         F_nNICIndex = Request.Form("hdnNICIndex")
  185.         
  186.         'Updating the variable for DNS
  187.         F_strPrimaryChecked                =    Request.Form("hdnradDNSPrimaryChecked")
  188.         F_strDNSSuffixesChecked            =    Request.Form("hdnradDNSSuffixChecked")
  189.         F_strPrimaryAndParentChecked    =    Request.Form("hdnchkAppendDNSSuffix")
  190.         F_strAppendDNSSuffix            =    Request.Form("chkAPPENDDNSSUFFIX")
  191.         F_strDNSSuffixes                =    Request.Form("hdnDNSSuffixes")
  192.         F_strDNSSuffix                    =    Request.Form("radDNSSUFFIX")
  193.         F_strDomainSuffix                =    Request.Form("txtDomainSuffix")
  194.                     
  195.         'Updating the variable for IPX Settings
  196.         F_strIPXVirtualNumber = Request.Form("txtIPXSettings")
  197.         F_strIPXSettings = Request.Form("hdnIPXSettings")
  198.                 
  199.         'Updating the variable for TCP\IP Hosts
  200.         F_strTCPHostData = Request.Form("txaTCPHosts")
  201.         
  202.         'Set the status of Checkbox and Textarea for LMHosts depending on the values
  203.         Call SetLMHostStatus()
  204.                     
  205.         OnPostBackPage = TRUE
  206.     
  207.     End Function
  208.  
  209.     '-------------------------------------------------------------------------
  210.     'Function:                OnSubmitPage()
  211.     'Description:            Called when the page has been submitted for processing.
  212.     'Input Variables:        PageIn,EventArg
  213.     'Output Variables:        PageIn,EventArg
  214.     'Returns:                True/False
  215.     'Global Variables:        None
  216.     '-------------------------------------------------------------------------
  217.     Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  218.         
  219.         Call SA_TraceOut(SOURCE_FILE, "OnSubmitPage")
  220.         
  221.         OnSubmitPage = False
  222.         
  223.         'To set the DNS Resolution
  224.         if Not(SetDNSResolutionSettings()) then
  225.             Exit Function
  226.         End if        
  227.         
  228.         'To set the LMHosts file and IPX settings 
  229.         if Not(SetLMHostsandIPXSettings()) then
  230.             Exit Function
  231.         End if            
  232.                     
  233.         'To set the TCP/IP Hosts file
  234.         if Not(SetTCPHostsData()) then
  235.             Exit Function
  236.         End if                    
  237.         
  238.         OnSubmitPage= True
  239.         
  240.     End Function
  241.     
  242.     '-------------------------------------------------------------------------
  243.     'Function:                OnClosePage()
  244.     'Description:            Called when the page is about to be closed.
  245.     'Input Variables:        PageIn,EventArg
  246.     'Output Variables:        PageIn,EventArg
  247.     'Returns:                True/False
  248.     'Global Variables:        None
  249.     '-------------------------------------------------------------------------    
  250.     Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  251.         
  252.         Call SA_TraceOut(SOURCE_FILE, "OnClosePage")
  253.         OnClosePage = TRUE
  254.         
  255.     End Function
  256.  
  257.     '-------------------------------------------------------------------------
  258.     'Function:                ServeTabDNS()
  259.     'Description:            Serve DNS Resolution tab
  260.     'Input Variables:        PageIn,bIsVisible    
  261.     'Output Variables:        PageIn
  262.     'Returns:                gc_ERR_SUCCESS
  263.     'Global Variables:        L_(*), G_(*)
  264.     '-------------------------------------------------------------------------
  265.     
  266.     Private Function ServeTabDNS(ByRef PageIn, ByVal bIsVisible)
  267.         
  268.         Call SA_TraceOut(SOURCE_FILE, "ServeTabDNS(oPageIn,  bIsVisible="+ CStr(bIsVisible) + ")")
  269.         
  270.         If ( bIsVisible ) Then
  271.             
  272.             'ServeCommonJavaScriptDNS is called for DNS initialising,validating and set data
  273.             Call ServeCommonJavaScriptDNS()
  274.             
  275.             'ServeCommonJavaScript is Common JavaScript function
  276.             Call ServeCommonJavaScript()
  277.                 
  278. %>        
  279.             <table valign="middle" align="left" border="0" cellspacing="0" cellpadding="0">
  280.                 <tr>
  281.                     <td nowrap colspan="3" class="TasksBody">
  282.                         <%=L_RESOLUTIONOFUNQUALIFIEDNAMES %>
  283.                     </td>
  284.                 </tr>
  285.                 <tr>    
  286.                     <td align="left" colspan="3" class="TasksBody">
  287.                         <input type=radio class="FormRadioButton" <%=F_strPrimaryChecked %>  value="PRIMARY" name="radDNSSUFFIX" onclick="OnRadioClick(this);"> <%=L_APPEND_PRIMARYDNSSUFFIX%>
  288.                     </td>
  289.                 </tr>
  290.                 <tr>
  291.                     <td class="TasksBody">
  292.                          
  293.                     </td>
  294.                     <td align="left" colspan="2" class="TasksBody">
  295.                         <input type="checkbox" class="FormCheckBox" onclick="SetPageChanged(true);" <%=F_strAppendDNSSuffix_EditStatus%>   value="PRIMARYANDPARENT"  <%=F_strPrimaryAndParentChecked%> name="chkAPPENDDNSSUFFIX" >
  296.                          <%=L_APPEND_PRIMARYDNSSUFFIX_AND_PARENTSUFFIXES%>
  297.                     </td>
  298.                 </tr>
  299.                 <tr>
  300.                     <td colspan="3" class="TasksBody">
  301.                         <input type=radio class="FormRadioButton" <%=F_strDNSSuffixesChecked%> value="SPECIFIC"  name=radDNSSUFFIX onclick="OnRadioClick(this); document.frmTask.txtDomainSuffix.focus()" > <%=L_APPEND_DNSSUFFIXES%>
  302.                     </td>
  303.                 </tr>
  304.                 <tr>
  305.                     <td  class="TasksBody">
  306.                          
  307.                     </td>
  308.                     <td valign="top" rowspan="3" class="TasksBody">
  309.                         <select  name="lstDNSSUFFIXES" size="4" style="width:100%;" onclick="ButtonStatus();">
  310.                             <%OutputDNSSUffixesToFormOptions()%>
  311.                         </select>
  312.                     </td>
  313.                     <td align="left" valign="top" class="TasksBody">
  314.                     <%
  315.                         Call SA_ServeOnClickButtonEx(L_UP, "", "MoveDNSSuffixUp()", 90, 0, "DISABLED", "btnUp")
  316.                     %>
  317.  
  318.                     </td>
  319.                 </tr>
  320.                 <tr>
  321.                     <td class="TasksBody">
  322.                          
  323.                     </td>    
  324.                     <td align="left" valign="top" class="TasksBody">
  325.                     <%
  326.                         Call SA_ServeOnClickButtonEx(L_DOWN, "", "MoveDNSSuffixDown()", 90, 0, "DISABLED", "btnDown")
  327.                     %>    
  328.  
  329.                     </td>
  330.                 </tr>
  331.                 <tr>
  332.                     <td class="TasksBody">
  333.                          
  334.                     </td>
  335.                     <td align="left" valign="top" class="TasksBody">
  336.                     <%
  337.                         Call SA_ServeOnClickButtonEx(L_REMOVE, "", "RemoveDNSSuffix()", 90, 0, "DISABLED", "btnRemove")
  338.                     %>
  339.  
  340.                     </td>
  341.                 </tr>
  342.                 <tr>
  343.                     <td class="TasksBody">
  344.                          
  345.                     </td>    
  346.                     <td colspan="2" class="TasksBody">
  347.                         <%=L_DOMAIN_SUFFIX_TEXT%>
  348.                     </td>
  349.                 </tr>    
  350.                 <tr>
  351.                     <td class="TasksBody">
  352.                          
  353.                     </td>    
  354.                     <td valign="top" class="TasksBody">
  355.                         <input type="Text" class="FormField" name=txtDomainSuffix size="45" maxlength="255" onkeyup="return addDNS(this,btnAdd)" onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE") value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDomainSuffix))%>">
  356.                     </td>
  357.                     <td align="left" valign="top" class="TasksBody">
  358.                     <%
  359.                         Call SA_ServeOnClickButtonEx(L_ADD, "", "AddNewDNSSuffix()", 90, 0, "DISABLED", "btnAdd")
  360.                     %>
  361.                     </td>
  362.                 </tr>
  363.  
  364.                 <input type="hidden" name="hdnDNSSuffixes">
  365.                 <input type="hidden" name="hdnNICIndex" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_nNICIndex))%>">
  366.                 <input type="hidden" name="hdnradDNSPrimaryChecked" value="<%=F_strPrimaryChecked%>" >
  367.                 <input type="hidden" name="hdnradDNSSuffixChecked" value="<%=F_strDNSSuffixesChecked%>">
  368.                 <input type="hidden" name="hdnchkAppendDNSSuffix" value="<%=F_strPrimaryAndParentChecked%>" >
  369.                                 
  370.             </table>    
  371. <%
  372.         Else 
  373. %>
  374.             <input type="hidden" name="txtDomainSuffix" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDomainSuffix))%>">
  375.             <input type="hidden" name="hdnDNSSuffixes" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDNSSuffixes))%>">
  376.             <input type="hidden" name="radDNSSUFFIX" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDNSSuffix))%>">
  377.             <input type="hidden" name="hdnNICIndex" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_nNICIndex))%>">
  378.             <input type="hidden" name="hdnradDNSPrimaryChecked" value="<%=F_strPrimaryChecked%>">
  379.             <input type="hidden" name="hdnradDNSSuffixChecked" value="<%=F_strDNSSuffixesChecked%>">
  380.             <input type="hidden" name="hdnchkAppendDNSSuffix" value="<%=F_strPrimaryAndParentChecked%>">
  381.             <input type="hidden" name="chkAPPENDDNSSUFFIX" value="PRIMARYANDPARENT">
  382. <%        
  383.         End If
  384.         
  385.         ServeTabDNS = gc_ERR_SUCCESS
  386.     
  387.     End Function
  388.     
  389.     '-------------------------------------------------------------------------
  390.     'Function:                ServeTabTCP()
  391.     'Description:            Serves TCP/IP hosts tab 
  392.     'Input Variables:        PageIn,bIsVisible    
  393.     'Output Variables:        PageIn
  394.     'Returns:                gc_ERR_SUCCESS
  395.     'Global Variables:        L_(*),F_strTCPHostData
  396.     '-------------------------------------------------------------------------
  397.  
  398.     Private Function ServeTabTCP(ByRef PageIn, ByVal bIsVisible)
  399.         
  400.         Call SA_TraceOut(SOURCE_FILE, "ServeTabTCP")
  401.     
  402.         If ( bIsVisible ) Then
  403.             
  404.             'ServeCommonJavaScriptTCP is called for TCP/IP initialising,validating and set data
  405.             Call ServeCommonJavaScriptTCP()
  406.             
  407.             'ServeCommonJavaScript is Common JavaScript function
  408.             Call ServeCommonJavaScript()
  409. %>
  410.             <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  411.                 <tr>
  412.                     <td class="TasksBody" nowrap valign=top colspan="2">
  413.                         <%=L_TCPHOST%>
  414.                     </td>
  415.                 </tr>    
  416.                 <tr>
  417.                     <td class="TasksBody">
  418.                            
  419.                     </td>
  420.                         
  421.                     <td class="TasksBody">
  422.                         <textarea  class="FormField"  rows="12" cols="90" wrap="off" name="txaTCPHOSTS"  onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE")><%=Server.HTMLEncode(F_strTCPHostData)%></textarea>
  423.                     </td>
  424.                 </tr>
  425.                 <tr>
  426.                     <td colspan="2" class="TasksBody"><%=L_TCPHOSTTEXT%>
  427.                     </td>
  428.                 </tr>
  429.             </table>
  430. <%
  431.         Else
  432. %>
  433.             <input type="hidden" name="txaTCPHOSTS" value = "<%=Server.HTMLEncode(F_strTCPHostData)%>">        
  434. <%
  435.         End If
  436.          
  437.         ServeTabTCP = gc_ERR_SUCCESS
  438.  
  439.     End Function
  440.     
  441.     '-------------------------------------------------------------------------
  442.     'Function:                ServeTabLMHosts()
  443.     'Description:            Serves LMHosts hosts tab
  444.     'Input Variables:        PageIn,bIsVisible    
  445.     'Output Variables:        PageIn
  446.     'Returns:                gc_ERR_SUCCESS
  447.     'Global Variables:        L_(*),F_(*)
  448.     '-------------------------------------------------------------------------
  449.     Private Function ServeTabLMHosts(ByRef PageIn, ByVal bIsVisible)
  450.                 
  451.         Call SA_TraceOut(SOURCE_FILE, "ServeTabLMHosts(PageIn,  bIsVisible="+ CStr(bIsVisible) + ")")
  452.         
  453.         If ( bIsVisible ) Then
  454.             
  455.             'ServeCommonJavaScriptLMHosts is called for LMHosts initialising,validating and set data
  456.             Call ServeCommonJavaScriptLMHOSTS()
  457.             
  458.             'ServeCommonJavaScript is a Common JavaScript function
  459.             Call ServeCommonJavaScript()
  460. %>        
  461.             <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  462.                 <tr>
  463.                     <td nowrap class="TasksBody" colspan="4">
  464.                         <%=L_LMHOSTS%>
  465.                     </td>
  466.                 </tr>
  467.                 <tr>
  468.                     <td colspan="4" class="TasksBody">
  469.                         <input type="checkbox" class="FormCheckBox" name="chkLMHOSTSLOOKUP" <%=F_strLMHOSTSLOOKUPSTATUS%> value="<%=F_strLMHOSTSLOOKUP%>" onclick="EnableLMHostText()" >  <%=L_ENABLED_LMHOSTS_LOOKUP%> 
  470.                     </td>
  471.                     
  472.                 </tr>
  473.                 <tr>        
  474.                     <td colspan="4" class="TasksBody">
  475.                         <textarea  class="FormField" wrap="off"  name="txaLMHOSTS" <%=F_strLMHOSTS_EDITSTATUS%> rows="12" cols="80" onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE") ><%=Server.HTMLEncode(F_strLMHOSTS)%></textarea>
  476.                     </td>
  477.                 </tr>
  478.                 <tr>
  479.                     <td colspan="4" class="TasksBody">
  480.                         <%=Server.HTMLEncode(SA_EscapeQuotes(L_LMHOSTS_MESSAGE_TEXT))%>
  481.                     </td>
  482.                 </tr>
  483.                                 
  484.                 <input type="hidden" name="hdnLMHOSTS" value="<%=F_strLMHOSTS_EDITSTATUS%>">    
  485.             </table>
  486. <%
  487.         Else 
  488. %>
  489.             <input type="hidden" name="chkLMHOSTSLOOKUP" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strLMHOSTSLOOKUP))%>" >
  490.             <input type="hidden" name="txaLMHOSTS" value="<%=Server.HTMLEncode(F_strLMHOSTS)%>">
  491.             <input type="hidden" name="hdnLMHOSTS" value="<%=F_strLMHOSTS_EDITSTATUS%>">    
  492. <%     
  493.         End If
  494.      
  495.         ServeTabLMHosts = gc_ERR_SUCCESS
  496.  
  497.     End Function
  498.  
  499.     '-------------------------------------------------------------------------
  500.     'Function:                ServeTabIPX()
  501.     'Description:            Serves for IPX settings tab
  502.     'Input Variables:        PageIn,bIsVisible    
  503.     'Output Variables:        PageIn
  504.     'Returns:                gc_ERR_SUCCESS
  505.     'Global Variables:        L_(*),F_(*)
  506.     '-------------------------------------------------------------------------
  507.     
  508.     Private Function ServeTabIPX(ByRef PageIn, ByVal bIsVisible)
  509.             
  510.         Call SA_TraceOut(SOURCE_FILE, "ServeTabIPX(oPageIn,  bIsVisible="+ CStr(bIsVisible) + ")")
  511.         
  512.         If ( bIsVisible ) Then
  513.             
  514.             'ServeCommonJavaScriptIPX is called for IPX initialising,validating and set data
  515.             Call ServeCommonJavaScriptIPX()
  516.             
  517.             'ServeCommonJavaScript() is a Common JavaScript function
  518.             Call ServeCommonJavaScript()
  519.         
  520.             If UCase(F_strIPXSettings) <> UCase("TRUE") then
  521. %>        
  522.                 <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  523.                     <tr>
  524.                         <td class="TasksBody" nowrap>
  525.                             <%=L_IPX_SETTINGS_ERRORMESSAGE%>
  526.                         </td>
  527.                     </tr>
  528.                 </table>
  529. <%
  530.             Else
  531.                             
  532. %>                <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  533.                     <tr>
  534.                         <td class="TasksBody" nowrap>
  535.                             <%=L_IPX_NETWORKNUMBER_TEXT%>  
  536.                             <input type="text" class="FormField" name="txtIPXSettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXVirtualNumber))%>" onkeypress="checkKeyforHexNumbers(this)" onblur ="validateIPXSettings(this)" maxlength="8" size="20">
  537.                         </td>
  538.                     </tr>
  539.                     <tr>
  540.                         <td class="TasksBody" nowrap>
  541.                             <%=L_IPX_NETWORKSETTINGS_TEXT%>
  542.                         </td>
  543.                     </tr>
  544.                 </table>
  545. <%
  546.             End If
  547. %>
  548.             <input type="hidden" name="hdnIPXSettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXSettings))%>">
  549. <%
  550.         Else
  551.         
  552.             If F_strIPXVirtualNumber <>"" then        
  553. %> 
  554.                 <input type="hidden" name="txtIPXSettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXVirtualNumber))%>">
  555.     
  556. <%
  557.             End If
  558.  
  559. %>        
  560.                 <input type="hidden" name="hdnipxsettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXSettings))%>">
  561.              
  562. <%        
  563.          End If
  564.          
  565.         ServeTabIPX = gc_ERR_SUCCESS
  566.  
  567.     End Function
  568.     
  569.     
  570.     '-------------------------------------------------------------------------
  571.     'Function:                ServeCommonJavaScriptDNS
  572.     'Description:            Serves in initialising the values,setting the form
  573.     '                        data and validating the form values for DNS tab
  574.     'Input Variables:        None
  575.     'Output Variables:        None
  576.     'Returns:                None
  577.     'Global Variables:        In:L_(*)-Localized strings
  578.     '-------------------------------------------------------------------------
  579.     Function ServeCommonJavaScriptDNS()
  580.     %>
  581.         <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  582.         </script>
  583.         
  584.         <script language="javascript">
  585.                     
  586.             //INIT for DNS Tab
  587.              function Init()
  588.             {
  589.                 var strReturnurl=location.href 
  590.                 var tempCnt=strReturnurl.indexOf("&ReturnURL="); 
  591.                 var straction=strReturnurl.substring(0,tempCnt) 
  592.                 document.frmTask.action = straction                 
  593.                 document.frmTask.Method.value = ""
  594.             
  595.                 var objlstSuffix=document.frmTask.lstDNSSUFFIXES;
  596.                 var objDomainSuffix=document.frmTask.txtDomainSuffix;
  597.                 
  598.                 if (document.frmTask.hdnradDNSPrimaryChecked.value.toUpperCase() == "CHECKED" )
  599.                 {
  600.                     document.frmTask.radDNSSUFFIX[0].checked = true
  601.                     if (document.frmTask.hdnchkAppendDNSSuffix.value.toUpperCase() == "CHECKED")
  602.                     {
  603.                         document.frmTask.chkAPPENDDNSSUFFIX.checked = true
  604.                     }    
  605.                     else
  606.                     {
  607.                         document.frmTask.chkAPPENDDNSSUFFIX.checked = false
  608.                     }    
  609.                 }
  610.                                 
  611.                 if (document.frmTask.hdnradDNSSuffixChecked.value.toUpperCase() == "CHECKED")
  612.                 {
  613.                     document.frmTask.radDNSSUFFIX[1].checked = true
  614.                 }            
  615.                         
  616.                 //Initializes the "DNS Suffixes to use " radio button group 
  617.                 //and DNS suffixes list box 
  618.                 if (objlstSuffix.length > 0)
  619.                 {
  620.                     objlstSuffix.options[0].selected = true;
  621.                     document.frmTask.btnUp.disabled = true;
  622.                 }        
  623.                 
  624.                 if (objlstSuffix.length == 1)
  625.                 {
  626.                     objlstSuffix.options[0].selected = true;
  627.                     document.frmTask.btnDown.disabled = true;
  628.                 }
  629.                                 
  630.                 if(document.frmTask.radDNSSUFFIX[0].checked)
  631.                 {
  632.                     EnableControls(document.frmTask.radDNSSUFFIX[0]);
  633.                 }
  634.                 else
  635.                 {
  636.                     EnableControls(document.frmTask.radDNSSUFFIX[1]);            
  637.                 }    
  638.                     
  639.                 //For clearing error when server side error occurs
  640.                 document.frmTask.onkeypress = ClearErr         
  641.                         
  642.                 //Call to disabe the add button    
  643.                 disableAddButton(objDomainSuffix,document.frmTask.btnAdd);
  644.             
  645.                 SetPageChanged(false);
  646.                 
  647.                 if (objlstSuffix.length == 1)
  648.                 {
  649.                     objlstSuffix.options[0].selected = true;
  650.                     document.frmTask.btnDown.disabled = true;
  651.                 }
  652.             }
  653.             
  654.             function ValidatePage()
  655.             {
  656.                 if (getRadioButtonValue(document.frmTask.radDNSSUFFIX).toUpperCase() == "SPECIFIC" && document.frmTask.lstDNSSUFFIXES.length == 0 )
  657.                 {
  658.                     SA_DisplayErr ("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_SEARCH_METHOD_TEXT))%>");
  659.                     document.frmTask.onkeypress = ClearErr 
  660.                     return false;
  661.                 }
  662.                 return true;
  663.                 
  664.             }
  665.         
  666.              function SetData()
  667.              {
  668.                 var objlstSuffix=document.frmTask.lstDNSSUFFIXES;
  669.                 var strList="";
  670.                     
  671.                 /*Retrieves values from DNS suffixes list box  and concatenates them 
  672.                 and stores it into a strList variable*/
  673.                 for ( var index=0; index < objlstSuffix.length; index++ )
  674.                 {
  675.                     strList += objlstSuffix.options[index].value + String.fromCharCode(1);
  676.                 }    
  677.                     
  678.                 strList = strList.slice(0,strList.length-1);    
  679.                 
  680.                 //Write the concatenated string into the hidden variable
  681.                 document.frmTask.hdnDNSSuffixes.value=strList;
  682.                 
  683.                 if(document.frmTask.radDNSSUFFIX[0].checked)
  684.                 {
  685.                     document.frmTask.hdnradDNSPrimaryChecked.value = "CHECKED"
  686.                     document.frmTask.hdnradDNSSuffixChecked.value = ""
  687.                     
  688.                     if (document.frmTask.chkAPPENDDNSSUFFIX.checked)
  689.                     {
  690.                         document.frmTask.hdnchkAppendDNSSuffix.value = "CHECKED"
  691.                     }    
  692.                     else
  693.                     {
  694.                         document.frmTask.hdnchkAppendDNSSuffix.value = ""
  695.                     }    
  696.                 }
  697.                 else
  698.                 {
  699.                     document.frmTask.hdnradDNSPrimaryChecked.value = ""
  700.                     document.frmTask.hdnradDNSSuffixChecked.value = "CHECKED"
  701.                 }    
  702.                     
  703.             }
  704.             
  705.             // OnTextInputChanged
  706.             // function that is invoked whenever a text input field is modified on the page.
  707.             function OnTextInputChanged(objText)
  708.             {
  709.                 SetPageChanged(true);
  710.             }
  711.  
  712.             // OnRadioOptionChanged
  713.             // function that is invoked whenever a radio input field is modified on the page.
  714.             function OnRadioOptionChanged(objRadio)
  715.             {
  716.                 SetPageChanged(true);
  717.             }
  718.         
  719.             //checks for initial ".", less than 255 chars, consecutive periods, less than
  720.             //63 chars between two periods
  721.             function checkdot(strInput)
  722.             {
  723.                 var strSplit
  724.                 var intIndex
  725.                         
  726.                 if (strInput.charAt(0) == "." )
  727.                 {
  728.                     return false;
  729.                 }
  730.                 
  731.                 if (strInput.length > 255)
  732.                 {
  733.                     return false;
  734.                 }    
  735.                                     
  736.                 if (strInput.indexOf(".") !=  -1)
  737.                 {
  738.                     strSplit = strInput.split(".")
  739.                                     
  740.                     for (intIndex = 0;intIndex < strSplit.length;intIndex++)  
  741.                     {
  742.                         if (strSplit[intIndex].length > 63)
  743.                         {
  744.                             return false;
  745.                         }    
  746.                     }    
  747.                 }    
  748.                 
  749.                 if (strInput.indexOf("..") != -1)
  750.                 {
  751.                     return false;
  752.                 }    
  753.                 
  754.                 return true;
  755.             }
  756.                 
  757.             //Adds new suffix to DNS suffixes list box
  758.             function AddNewDNSSuffix()
  759.             {
  760.                 SetPageChanged(true);
  761.                 
  762.                 var objlstSuffix=document.frmTask.lstDNSSUFFIXES;
  763.                 var objDomainSuffix=document.frmTask.txtDomainSuffix;
  764.  
  765.                     
  766.                 // checking for null value and for the invalid input by calling checkdot function
  767.                 if ( objDomainSuffix.value.length != 0 && !IsAllSpaces(objDomainSuffix.value) && checkdot(document.frmTask.txtDomainSuffix.value))
  768.                 {        
  769.                 
  770.                 
  771.                     //Only a maximum of 20 entries are allowed in DNS Suffix list box    
  772.                     if (objlstSuffix.length < 20)
  773.                     {    
  774.                         //Add to the list                    
  775.                         if(!addToListBox(objlstSuffix, document.frmTask.btnAdd, objDomainSuffix.value, objDomainSuffix.value))
  776.                         {
  777.                             SA_DisplayErr("<%=Server.HTMLEncode(L_ERR_DNSSUFFIXALREADYEXISTS)%>");
  778.                             
  779.                             return false;
  780.                         }
  781.                         
  782.                         else
  783.                         {                    
  784.                             objDomainSuffix.value="";
  785.  
  786.                             // call to disabe the add button    
  787.                             disableAddButton(document.frmTask.txtDomainSuffix,document.frmTask.btnAdd);
  788.                                                 
  789.                             /*  Checking the length Domain suffix list box ,
  790.                              and selecting the first entry and enabling REMOVE button */
  791.                             if ( objlstSuffix.length == 1)
  792.                             {                        
  793.                                 document.frmTask.btnRemove.disabled= false ;
  794.                                 document.frmTask.btnDown.disabled = true;
  795.                                 document.frmTask.btnUp.disabled = true;
  796.                                 objlstSuffix.options[objlstSuffix.length-1].selected=true;
  797.                             }
  798.                             else    
  799.                             {
  800.                                 if ( objlstSuffix.length > 0)
  801.                                 {
  802.                                     document.frmTask.btnRemove.disabled= false ;
  803.                                     document.frmTask.btnDown.disabled = true
  804.                                     document.frmTask.btnUp.disabled = false
  805.                                     objlstSuffix.options[objlstSuffix.length-1].selected=true;
  806.                                 }
  807.                             }
  808.                         }        
  809.                     }    
  810.                 }
  811.                 else
  812.                 {
  813.                     SA_DisplayErr ("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DNSNAME_TEXT))%>");
  814.                     document.frmTask.txtDomainSuffix.focus()    
  815.                     document.frmTask.onkeypress = ClearErr;
  816.                 }
  817.  
  818.             }
  819.         
  820.             //Removes the selected suffix from DNS suffixes list box
  821.             function RemoveDNSSuffix()
  822.             {
  823.                 SetPageChanged(true);
  824.                     
  825.                 var objSuffix=document.frmTask.lstDNSSUFFIXES;    
  826.                 var SelectedIndex=objSuffix.selectedIndex;
  827.                 if ( objSuffix.length > 1 )
  828.                 {
  829.                     objSuffix.options[SelectedIndex]=null;
  830.                     
  831.                     
  832.                     if ( objSuffix.length == 1 )
  833.                     {
  834.                         document.frmTask.btnUp.disabled = true;
  835.                         document.frmTask.btnDown.disabled = true;
  836.                     }
  837.                     else if (SelectedIndex == 0)
  838.                     {
  839.                         document.frmTask.btnUp.disabled = true;
  840.                     }
  841.                     else
  842.                     {    
  843.                         if ((SelectedIndex-1) == 0)
  844.                         {
  845.                             document.frmTask.btnUp.disabled = true;
  846.                         }    
  847.                     }    
  848.                 }        
  849.                 else
  850.                 {
  851.                     objSuffix.options[SelectedIndex]=null;
  852.                     document.frmTask.btnUp.disabled        =    true;
  853.                     document.frmTask.btnRemove.disabled    =    true;
  854.                     document.frmTask.btnDown.disabled    =    true;
  855.                     selectFocus(document.frmTask.txtDomainSuffix)
  856.                 }
  857.             
  858.                 if (objSuffix.length>0)
  859.                 {    
  860.                     objSuffix.options[objSuffix.length-1].selected = true;
  861.                 }
  862.                     
  863.                 
  864.             }
  865.             // end of function RemoveSuffix()
  866.         
  867.             // Enable or disable ADD and REMOVE Buttons on click event of Radio buttons
  868.             function EnableControls(objRadio)
  869.             {
  870.                 if ( objRadio.value == "PRIMARY"  )
  871.                 {
  872.                     document.frmTask.btnAdd.disabled       = true;
  873.                     document.frmTask.btnRemove.disabled    = true;
  874.                     document.frmTask.btnUp.disabled           = true;
  875.                     document.frmTask.btnDown.disabled       = true;    
  876.                     document.frmTask.txtDomainSuffix.disabled = true;
  877.                     document.frmTask.txtDomainSuffix.value    = "";
  878.                     document.frmTask.lstDNSSUFFIXES.length  = 0;
  879.                     document.frmTask.lstDNSSUFFIXES.disabled= true;
  880.                     document.frmTask.chkAPPENDDNSSUFFIX.disabled=false;
  881.                 }
  882.                 else
  883.                 {                
  884.                     // call to disabe the add button    
  885.                     disableAddButton(document.frmTask.txtDomainSuffix,document.frmTask.btnAdd);
  886.                         
  887.                     if(document.frmTask.lstDNSSUFFIXES.length == 0 )
  888.                     {
  889.                         document.frmTask.btnRemove.disabled    = true ;
  890.                             document.frmTask.btnUp.disabled           = true ;
  891.                         document.frmTask.btnDown.disabled       = true ;
  892.                                 
  893.                     }
  894.                     else
  895.                     {
  896.                         document.frmTask.btnRemove.disabled    = false ;
  897.                         document.frmTask.btnDown.disabled       = false ;    
  898.                         if (document.frmTask.lstDNSSUFFIXES.selectedIndex != 0)
  899.                         {
  900.                             document.frmTask.btnUp.disabled           = false ;
  901.                         }    
  902.                     }
  903.                     document.frmTask.txtDomainSuffix.disabled = false;    
  904.                     document.frmTask.lstDNSSUFFIXES.disabled= false;
  905.                     document.frmTask.chkAPPENDDNSSUFFIX.checked=false;
  906.                     document.frmTask.chkAPPENDDNSSUFFIX.disabled=true;
  907.                 }    
  908.             }
  909.         
  910.             function AddText(objTextBox,objButton)
  911.             {
  912.                 var nKeyCode                
  913.                 nKeyCode = window.event.keyCode;                
  914.                 if (nKeyCode ==13)
  915.                 {
  916.                     objButton.click()                
  917.                     return false
  918.                 }
  919.                 return true                
  920.             }
  921.             function addDNS(objTextBox,objButton)                        
  922.             {
  923.                 SetPageChanged(true);
  924.                 disableAddButton(objTextBox,objButton)                        
  925.                 return AddText(objTextBox,objButton)
  926.             }
  927.             function OnRadioClick(objControl)
  928.             {
  929.                 SetPageChanged(true);
  930.                 EnableControls(objControl);
  931.             }
  932.             
  933.             //To move up in DNS suffix list box
  934.             function MoveDNSSuffixUp()
  935.             {
  936.                 var objSuffix=document.frmTask.lstDNSSUFFIXES;    
  937.                 var SelectedIndex=objSuffix.selectedIndex;
  938.                 var strChangedValue;
  939.                 var strOriginalValue;
  940.  
  941.                 strChangedValue = objSuffix.options[SelectedIndex-1].value;
  942.                 strOriginalValue = objSuffix.options[SelectedIndex].value;
  943.                 objSuffix.options[SelectedIndex] = new Option(strChangedValue,strChangedValue,false,false);
  944.                 objSuffix.options[SelectedIndex-1] = new Option(strOriginalValue,strOriginalValue,false,false);
  945.                 
  946.                 document.frmTask.btnDown.disabled = false;
  947.                 objSuffix.options[SelectedIndex-1].selected=true;
  948.                 if    ((SelectedIndex-1) == 0) 
  949.                 {
  950.                     document.frmTask.btnUp.disabled = true; 
  951.                 }
  952.                             
  953.             }
  954.             
  955.             //To move down in DNS suffix list box
  956.             function MoveDNSSuffixDown()
  957.             {
  958.                 var objSuffix=document.frmTask.lstDNSSUFFIXES;    
  959.                 var SelectedIndex=objSuffix.selectedIndex;
  960.                 var strChangedValue;
  961.                 var strOriginalValue;
  962.  
  963.                 strChangedValue = objSuffix.options[SelectedIndex+1].value;
  964.                 strOriginalValue = objSuffix.options[SelectedIndex].value;
  965.                 objSuffix.options[SelectedIndex] = new Option(strChangedValue,strChangedValue,false,false);
  966.                 objSuffix.options[SelectedIndex+1] = new Option(strOriginalValue,strOriginalValue,false,false);
  967.  
  968.                 document.frmTask.btnUp.disabled = false
  969.                 objSuffix.options[SelectedIndex+1].selected=true;
  970.                 if ( SelectedIndex == (objSuffix.length - 2) )     
  971.                 {
  972.                     document.frmTask.btnDown.disabled = true
  973.                 }
  974.             }
  975.         
  976.             //Function to make the up and down buttons Enabled or Disabled
  977.             function ButtonStatus()
  978.             {
  979.                 var objSuffix=document.frmTask.lstDNSSUFFIXES;    
  980.                 var nSelectedIndex=objSuffix.selectedIndex;
  981.                 var nDnsListlength=objSuffix.length;
  982.                 
  983.                 if ( nSelectedIndex == 0)
  984.                 {
  985.                     document.frmTask.btnUp.disabled = true
  986.                     document.frmTask.btnDown.disabled = false
  987.                     
  988.                 }
  989.                 else
  990.                 {
  991.                     if ( nSelectedIndex == (objSuffix.length - 1))    
  992.                     {
  993.                         document.frmTask.btnDown.disabled = true
  994.                         document.frmTask.btnUp.disabled = false
  995.                     }
  996.                     else
  997.                     {
  998.                         document.frmTask.btnUp.disabled = false
  999.                         document.frmTask.btnDown.disabled = false
  1000.                     }    
  1001.                 }
  1002.                 
  1003.                 if(nDnsListlength==0 || nDnsListlength==1 )
  1004.                 {
  1005.                     document.frmTask.btnUp.disabled = true
  1006.                     document.frmTask.btnDown.disabled = true
  1007.                 }
  1008.                 
  1009.                 
  1010.             }    
  1011.  
  1012.  
  1013.         </script>
  1014. <%
  1015.     End Function
  1016.         
  1017.     '-------------------------------------------------------------------------
  1018.     'Function:                ServeCommonJavaScriptTCP
  1019.     'Description:            Serves in initialising the values,setting the form
  1020.     '                        data and validating the form values for TCP/IP tab
  1021.     'Input Variables:        None
  1022.     'Output Variables:        None
  1023.     'Returns:                None
  1024.     'Global Variables:        None
  1025.     '-------------------------------------------------------------------------    
  1026.  
  1027.     Function ServeCommonJavaScriptTCP()
  1028. %>
  1029.         <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  1030.         </script>
  1031.         
  1032.         <script language="javascript">
  1033.                     
  1034.             //INIT for TCP/IP Tab
  1035.             function Init()
  1036.             {
  1037.             
  1038.             }
  1039.             
  1040.             function ValidatePage()
  1041.             {
  1042.         
  1043.                 return true;
  1044.             }
  1045.  
  1046.             function SetData()
  1047.             {
  1048.         
  1049.             }
  1050.         </script>
  1051. <%
  1052.     End Function
  1053.  
  1054.     '-------------------------------------------------------------------------
  1055.     'Function:                ServeCommonJavaScriptLMHOSTS
  1056.     'Description:            Serves in initialising the values,setting the form
  1057.     '                        data and validating the form values for LMHOSTS Tab
  1058.     'Input Variables:        None
  1059.     'Output Variables:        None
  1060.     'Returns:                None
  1061.     'Global Variables:        None
  1062.     '-------------------------------------------------------------------------    
  1063.  
  1064.     Function ServeCommonJavaScriptLMHOSTS()
  1065.     %>
  1066.         <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  1067.         </script>
  1068.         
  1069.         <script language="javascript">
  1070.                     
  1071.             //INIT for LMHOSTS Tab
  1072.             function Init()
  1073.             {
  1074.             
  1075.             }
  1076.             
  1077.             // LMHosts ValidatePage Function
  1078.             function ValidatePage()
  1079.             {
  1080.                 //retaining the value in hidden variable when text area is disabled
  1081.                 //document.frmTask.hdnLMHOSTSText.value=document.frmTask.txaLMHOSTS.value
  1082.                 return true;
  1083.             }
  1084.             
  1085.             
  1086.             function SetData()
  1087.             {
  1088.         
  1089.             }
  1090.             
  1091.             // Enable or disable LMHost text area depending on the value of LMHOST LOOKUP Check Box
  1092.             function EnableLMHostText()
  1093.             {
  1094.                 if (document.frmTask.chkLMHOSTSLOOKUP.checked)
  1095.                 {
  1096.                     document.frmTask.chkLMHOSTSLOOKUP.value = "CHECKED"
  1097.                     document.frmTask.txaLMHOSTS.disabled = false;    
  1098.                 }
  1099.                 else
  1100.                 {
  1101.                     document.frmTask.txaLMHOSTS.disabled = true;
  1102.                     document.frmTask.chkLMHOSTSLOOKUP.value = ""
  1103.                 }
  1104.             }
  1105.             
  1106.         </script>
  1107. <%
  1108.     End Function
  1109.  
  1110.     '-------------------------------------------------------------------------
  1111.     'Function:                ServeCommonJavaScriptIPX
  1112.     'Description:            Serves in initialising the values,setting the form
  1113.     '                        data and validating the form values for IPX settings
  1114.     'Input Variables:        None
  1115.     'Output Variables:        None
  1116.     'Returns:                None
  1117.     'Global Variables:        None
  1118.     '-------------------------------------------------------------------------
  1119.     Function ServeCommonJavaScriptIPX()
  1120.     %>
  1121.         <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  1122.         </script>
  1123.         
  1124.         <script language="javascript">
  1125.                     
  1126.             //INIT for IPX settings Tab
  1127.             function Init()
  1128.             {
  1129.             
  1130.             }
  1131.             
  1132.             function ValidatePage()
  1133.             {
  1134.                 return true;
  1135.             }
  1136.  
  1137.             function SetData()
  1138.             {
  1139.         
  1140.             }
  1141.             
  1142.             //To check for the keys. It should allow only 0-9 and A-F 
  1143.             function checkKeyforHexNumbers(obj)
  1144.             {
  1145.                 if (!((window.event.keyCode >=48  && window.event.keyCode <=57) || (window.event.keyCode >=65  && window.event.keyCode <=70) || (window.event.keyCode >=97  && window.event.keyCode <=102)))
  1146.                 {
  1147.                     window.event.keyCode = 0;
  1148.                     obj.focus();
  1149.                 }
  1150.             }
  1151.         
  1152.             //Validation for IPX settings Text Box
  1153.             function validateIPXSettings(obj)
  1154.             {
  1155.                 var strIPXval
  1156.                 var intIPXval
  1157.                     
  1158.                 strIPXval = document.frmTask.txtIPXSettings.value 
  1159.                 intIPXval = strIPXval.length
  1160.                 if (intIPXval < 9)
  1161.                 {
  1162.                     for (i=0; i<(8 - intIPXval); i++)
  1163.                     {
  1164.                         strIPXval = 0 + strIPXval 
  1165.                     }
  1166.                 }
  1167.                             
  1168.                 document.frmTask.txtIPXSettings.value  = strIPXval.toUpperCase()
  1169.             }
  1170.             
  1171.             
  1172.         </script>
  1173. <%
  1174.     End Function
  1175.         
  1176.     '-------------------------------------------------------------------------
  1177.     'Function:                ServeCommonJavaScript
  1178.     'Description:            Validating the form values 
  1179.     'Input Variables:        None
  1180.     'Output Variables:        None
  1181.     'Returns:                None
  1182.     'Global Variables:        None
  1183.     '-------------------------------------------------------------------------
  1184.     Function ServeCommonJavaScript()
  1185.     %>
  1186.         <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  1187.         </script>
  1188.         
  1189.         <script language="javascript">
  1190.                         
  1191.             //To disable Enter and Escape key actions 
  1192.             function HandleKey(input)
  1193.             {
  1194.                 if(input == "DISABLE")
  1195.                     document.onkeypress = "";
  1196.                 else
  1197.                     document.onkeypress = HandleKeyPress;
  1198.             }
  1199.             
  1200.         </script>
  1201.         
  1202. <%
  1203.     End Function
  1204.  
  1205.     '-------------------------------------------------------------------------
  1206.     'Subroutine:            GetInitialValues
  1207.     'Description:            Gets the initial settings for DNS, and IPX from the system
  1208.     'Input Variables:        None
  1209.     'Output Variables:        None
  1210.     'Returns:                None
  1211.     'Global Variables:        G_objService, F_nNICIndex,F_strIPXSettings,F_strIPXVirtualNumber
  1212.     '                        F_strLMHOSTSLOOKUPSTATUS,F_strPrimaryChecked, F_strPrimaryAndParentChecked
  1213.     '                        F_strDNSSuffixesChecked, F_strAppendDNSSuffix_EditStatus, G_objRegistry
  1214.     '                        L_(*)
  1215.     '-------------------------------------------------------------------------    
  1216.     
  1217.     Sub GetInitialValues
  1218.     
  1219.         Err.Clear
  1220.         On Error Resume Next
  1221.     
  1222.         Dim objNACCollection                'WMI connection
  1223.         Dim objNICInstance                    'To get instances of Win32_NetworkAdapterConfiguration
  1224.         Dim nNICIndex                        'Index for which IPEnabled is true
  1225.         Dim strIPXSettings                    'Value of IPXSettings
  1226.         Dim strIPXVirtualNumber                'IPX network virtual number    
  1227.         Dim strWINSEnableLMHostsLookup        'value of WINSEnableLMHostsLookup
  1228.         Dim nUseDomainNameDevolution        'Gets status of registry key
  1229.         Dim strDNSDomainSuffixSearchOrder    'Value of DNSDomainSuffixSearchOrder
  1230.                 
  1231.         'Getting registry connection
  1232.         Call RegistryConnection()
  1233.         
  1234.         Set G_objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1235.         
  1236.         If Err.number<>0 then 
  1237.             Call SA_ServeFailurePageEx(L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE, mstrReturnURL)
  1238.             Exit Sub
  1239.         End if
  1240.         
  1241.         'Getting the Win32_NetworkAdapterConfiguration instance for which IPEnabled is true
  1242.         Set objNACCollection = G_objService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled = true")
  1243.         
  1244.         'Error message when failed to get Win32_NetworkAdapterConfiguration instance
  1245.         If  Err.number <>  0 Then
  1246.             Call SA_ServeFailurePageEx(L_COULDNOTGET_WIN32NETADAPTERCONFIG_ERRORMESSAGE, mstrReturnURL)
  1247.             Exit Sub
  1248.         End if    
  1249.         
  1250.         'checking for the Zero count of the NIC cards if so raise error message
  1251.         If (objNACCollection.Count = 0) Then
  1252.             Call SA_ServeFailurePageEx(L_NO_IPENABLED_NICCARDS_FOUND_ERRORMESSAGE , mstrReturnURL)
  1253.             Exit Sub
  1254.         End If
  1255.         
  1256.         'Retrieving the values of Win32_NetworkAdapterConfiguration for which IP is enabled
  1257.         For Each objNICInstance In objNACCollection
  1258.             nNICIndex = objNICInstance.Index
  1259.             strWINSEnableLMHostsLookup = objNICInstance.WINSEnableLMHostsLookup
  1260.             strIPXSettings = objNICInstance.IPXEnabled
  1261.             strIPXVirtualNumber = objNICInstance.IPXVirtualNetNumber
  1262.             strDNSDomainSuffixSearchOrder = objNICInstance.DNSDomainSuffixSearchOrder
  1263.             Exit For
  1264.         Next
  1265.         
  1266.         'Assigning values to form variables
  1267.         F_nNICIndex = nNICIndex
  1268.         F_strIPXSettings = strIPXSettings
  1269.         F_strIPXVirtualNumber = strIPXVirtualNumber
  1270.         
  1271.         'Getting registry settings and depending on that updating the form variables            
  1272.         If (IsNull(strDNSDomainSuffixSearchOrder) ) Then
  1273.             F_strPrimaryChecked= "CHECKED"
  1274.             nUseDomainNameDevolution=getRegkeyvalue(G_objRegistry,CONST_DNSREGISTEREDADAPTERSPATH,"UseDomainNameDevolution",CONST_DWORD)
  1275.             If nUseDomainNameDevolution = 1 then
  1276.                 F_strPrimaryAndParentChecked    = "CHECKED"            
  1277.             End if
  1278.         Else    
  1279.             F_strDNSSuffixesChecked="CHECKED"
  1280.             F_strAppendDNSSuffix_EditStatus = "DISABLED"            
  1281.         End if    
  1282.         
  1283.         'Depending on WINSEnableLMHostsLookup updating the form variables for LMHOSTS
  1284.         If strWINSEnableLMHostsLookup Then
  1285.             F_strLMHOSTSLOOKUP = UCase("CHECKED")
  1286.         End if
  1287.         
  1288.         'Releasing the object
  1289.         Set objNICInstance = Nothing
  1290.         Set objNACCollection = Nothing
  1291.         
  1292.     End Sub
  1293.     
  1294.     '-------------------------------------------------------------------------
  1295.     'Subroutine:        GetLMHostsandTCPFileData
  1296.     'Description:        Gets data in LMHosts and TCP Hosts file
  1297.     'Input Variables:    None    
  1298.     'Output Variables:    None    
  1299.     'Returns:            None
  1300.     'Global Variables:    L_(*)-Localized strings,F_strTCPHostData
  1301.     '                    F_strLMHOSTS, F_strLMHOSTSLOOKUP, F_strLMHOSTS_EDITSTATUS
  1302.     '-------------------------------------------------------------------------
  1303.     Sub GetLMHostsandTCPFileData()
  1304.         
  1305.         Err.Clear
  1306.         on error resume next
  1307.                  
  1308.         Dim objFileSystem            'File system object
  1309.         Dim objFile                    'Instance of LMHosts file system object
  1310.         Dim strLMHostsFilePath        'LMHosts file path
  1311.         Dim strTCPHostsFile            'TCP/IP file path
  1312.         Dim objTCPFile                'Instance of TCP/IP Hosts file system object
  1313.                             
  1314.         'Retrieving the path of TCP/IP Hosts File 
  1315.         strTCPHostsFile = GetSystemPath
  1316.         strTCPHostsFile = strTCPHostsFile & CONST_DRIVERSETCHOSTS
  1317.         
  1318.         'Retrieving the path of LMHosts File 
  1319.         strLMHostsFilePath = GetSystemPath 
  1320.         strLMHostsFilePath = strLMHostsFilePath & CONST_DRIVERSETCLMHOSTS
  1321.                 
  1322.         'Create file system object
  1323.         Set objFileSystem= Server.CreateObject("Scripting.FileSystemObject")            
  1324.         
  1325.         'Error in creating file system object
  1326.         If  Err.number <> 0 Then
  1327.             SA_SetErrMsg L_ERROR_IN_CREATING_SCRIPTING_FILESYSTEMOBJECT_ERRORMESSAGE & "(" & Hex(Err.Number) & ")" 
  1328.             Exit Sub
  1329.         End If    
  1330.         
  1331.         'Create instance of TCP/IP Hosts file system object    
  1332.         Set objTCPFile=objFileSystem.OpenTextFile(strTCPHostsFile,1)
  1333.         
  1334.         'Read the TCP/IP Hosts file
  1335.         If not objTCPFile.AtEndofStream Then
  1336.             F_strTCPHostData = objTCPFile.readAll
  1337.         End if
  1338.         
  1339.         'Close the file object
  1340.         objTCPFile.close
  1341.         
  1342.         'Create instance of LMHosts file system object    
  1343.         Set objFile=objFileSystem.OpenTextFile(strLMHostsFilePath,1)
  1344.             
  1345.         'Read the LMHOSTS file    
  1346.         If not objFile.AtEndofStream Then
  1347.             F_strLMHOSTS = objFile.ReadAll()
  1348.         End IF    
  1349.         
  1350.         'Close the file object
  1351.         objFile.Close
  1352.                 
  1353.         Set objTCPFile = Nothing
  1354.         Set objFileSystem = Nothing
  1355.         Set objFile = Nothing
  1356.         
  1357.     End Sub
  1358.     
  1359.     '-------------------------------------------------------------------------
  1360.     'Function name:        SetLMHostsandIPXSettings()
  1361.     'Description:        Serves in updating LMHosts and IPX Settings
  1362.     'Input Variables:    None    
  1363.     'Output Variables:    True/false
  1364.     'Returns:            True/false
  1365.     'Global Variables:    G_objService,F_nNICIndex, F_strLMHOSTSLOOKUP,
  1366.     '                    F_strLMHOSTS, L_(*)-Localized strings
  1367.     '-------------------------------------------------------------------------                    
  1368.     Function SetLMHostsandIPXSettings()        
  1369.         
  1370.         Err.Clear 
  1371.         On Error Resume Next 
  1372.  
  1373.         Dim strLMHostsFilePath
  1374.         Dim nretval
  1375.         Dim strLMHostspath
  1376.         Dim objFileSystem
  1377.         Dim objFile
  1378.                 
  1379.         SetLMHostsandIPXSettings = False
  1380.         
  1381.         strLMHostspath = "\drivers\etc\lmhosts"
  1382.         
  1383.         'Getting registry connection
  1384.         Call RegistryConnection()
  1385.         
  1386.         'Coverting F_strIPXVirtualNumber to hexadecimal
  1387.         F_strIPXVirtualNumber = "&H" & F_strIPXVirtualNumber 
  1388.         
  1389.         'Coverting F_strIPXVirtualNumber to long
  1390.         F_strIPXVirtualNumber = CLng(F_strIPXVirtualNumber) 
  1391.         
  1392.         'This is used to convert signed integer to unsigned integer 
  1393.         If F_strIPXVirtualNumber < 0 Then 
  1394.             F_strIPXVirtualNumber = F_strIPXVirtualNumber + UNSIGNEDINT_FORMATTER
  1395.         End If 
  1396.         
  1397.         'updating the registry with IPX Settings
  1398.         If UCase(F_strIPXSettings) = UCase(True) then
  1399.             nretval=updateRegkeyvalue(G_objRegistry,CONST_NETBIOSREGISTRYENABLELMHOSTSPATH,"VirtualNetworkNumber",F_strIPXVirtualNumber,CONST_DWORD)
  1400.         End If
  1401.         
  1402.         
  1403.         If Ucase(F_strLMHOSTSLOOKUP) = UCase("CHECKED") Then                
  1404.  
  1405.             'updating the registry with the value of  "EnableLMHOSTS" check box 
  1406.             nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTRYENABLELMHOSTSPATH,"EnableLMHOSTS",1,CONST_DWORD)
  1407.                     
  1408.             'Get LMHosts file path
  1409.             strLMHostsFilePath = GetSystemPath
  1410.             strLMHostsFilePath = strLMHostsFilePath & strLMHostspath    
  1411.             
  1412.             'Creating the File system object
  1413.             Set objFileSystem= Server.CreateObject("Scripting.FileSystemObject")            
  1414.             
  1415.             If  Err.number <> 0 Then
  1416.                 SA_SetErrMsg L_ERROR_IN_CREATING_SCRIPTING_FILESYSTEMOBJECT_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1417.                 Exit Function
  1418.             End If
  1419.     
  1420.             'Creating the Text File object
  1421.             Set objFile=objFileSystem.OpenTextFile(strLMHostsFilePath,2,True)    
  1422.             
  1423.             If  Err.number <> 0 Then
  1424.                 SA_SetErrMsg L_ERROR_IN_CREATINGTEXTFILE_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1425.                 Exit Function
  1426.             End If    
  1427.             
  1428.             'Writing into the LMHOSTS file
  1429.             objFile.Write F_strLMHOSTS    
  1430.                 
  1431.             If Err.number <> 0 Then
  1432.                 SA_SetErrMsg L_ERROR_OCCURED_WHILE_UPDATING_HOSTSFILE & "(" & Hex(Err.Number) & ")"
  1433.                 Exit Function
  1434.             End If        
  1435.             
  1436.             'Close file object
  1437.             objFile.Close 
  1438.             
  1439.             'Release the objects
  1440.             Set objFile = Nothing
  1441.             Set objFileSystem = Nothing
  1442.                                 
  1443.         Else        
  1444.             'updating the registry with the value of  "EnableLMHOSTS" check box 
  1445.             nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTRYENABLELMHOSTSPATH,"EnableLMHOSTS",0,CONST_DWORD)        
  1446.         End if        
  1447.         
  1448.         SetLMHostsandIPXSettings = True    
  1449.                 
  1450.     End Function    
  1451.     
  1452.     '-------------------------------------------------------------------------
  1453.     'Function name:        SetLMHostStatus()
  1454.     'Description:        Set the status of Checkbox and Textarea for LMHosts
  1455.     '                    depending on the initial values
  1456.     'Input Variables:    None    
  1457.     'Output Variables:    F_strLMHOSTSLOOKUPSTATUS,F_strLMHOSTS_EDITSTATUS
  1458.     'Returns:            None
  1459.     'Global Variables:    F_strLMHOSTSLOOKUP,F_strLMHOSTSLOOKUPSTATUS,F_strLMHOSTS_EDITSTATUS
  1460.     '-------------------------------------------------------------------------    
  1461.     Function SetLMHostStatus()
  1462.         
  1463.         Err.Clear 
  1464.         On Error Resume Next 
  1465.         
  1466.         If Ucase(F_strLMHOSTSLOOKUP) = Ucase("CHECKED") Then
  1467.             F_strLMHOSTSLOOKUPSTATUS = Ucase("CHECKED")
  1468.             F_strLMHOSTS_EDITSTATUS = Ucase("ENABLED")
  1469.         Else
  1470.             F_strLMHOSTSLOOKUPSTATUS = ""
  1471.             F_strLMHOSTS_EDITSTATUS = Ucase("DISABLED")
  1472.         End If
  1473.         
  1474.     End Function    
  1475.     
  1476.     '-------------------------------------------------------------------------
  1477.     'Function name:        SetDNSResolutionSettings()
  1478.     'Description:        Serves in updating DNS Resolution
  1479.     'Input Variables:    None    
  1480.     'Output Variables:    True or false
  1481.     'Returns:            True or false
  1482.     'Global Variables:    In:G_objService - WMI server object
  1483.     '                    In:G_objRegistry - Registry object .
  1484.     '                    In:F_strDNSSUFFIX - DNS Suffixes to use
  1485.     '                    In:F_strDNSSUFFIXes - String with concatenated DNS Suffixes to use          
  1486.     '                    In:F_nNICIndex- instance of Win32_NetworkAdapterConfiguration for which IP enabled.            
  1487.     '                    In:F_strAPPENDDNSSUFFIX - Append primary DNS suffix and parent suffixes option    
  1488.     '                    In:F_strLMHOSTSLOOKUP - Value of LMHost Lookup    check box
  1489.     '                    Out:F_strLMHOSTS - data into LMHost File
  1490.     '                    In:L_(*)-Localized strings
  1491.     '-------------------------------------------------------------------------                    
  1492.     Function SetDNSResolutionSettings        
  1493.         
  1494.         Err.Clear 
  1495.         On Error Resume Next 
  1496.  
  1497.         Dim objNetWorkAdCon
  1498.         Dim arrDNSSuffixes        
  1499.         Dim nretval
  1500.         
  1501.         SetDNSResolutionSettings = false
  1502.                 
  1503.         'Getting registry conection
  1504.         Call RegistryConnection()
  1505.         
  1506.         'Getting WMI connection
  1507.         Set G_objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1508.         
  1509.         If Err.number<>0 then 
  1510.             Call SA_ServeFailurePageEx(L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE, mstrReturnURL)
  1511.             Exit Function
  1512.         End if
  1513.         
  1514.         'Get the class Win32_NetworkAdapterConfiguration
  1515.         Set objNetWorkAdCon = G_objService.Get("Win32_NetworkAdapterConfiguration")        
  1516.         
  1517.         'Splitting the concatenated string into an array of DNS
  1518.         arrDNSSuffixes = Split(F_strDNSSuffixes, Chr(1),-1,0)
  1519.                 
  1520.         If  UCase(F_strDNSSuffix) = Ucase("SPECIFIC") Then
  1521.             'Setting the DNS array in order
  1522.             objNetWorkAdCon.SetDNSSuffixSearchOrder( arrDNSSuffixes )
  1523.         Else
  1524.             If Trim(UCase(F_strDNSSuffix)) = Ucase("PRIMARY") Then
  1525.                 objNetWorkAdCon.SetDNSSuffixSearchOrder( Array() )
  1526.                 'updating the registry with the value of "PRIMARYANDPARENT" check box 
  1527.                 If Trim(UCase(F_strAppendDNSSuffix)) = "PRIMARYANDPARENT" then
  1528.                     nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTEREDADAPTERSPATH,"UseDomainNameDevolution",1,CONST_DWORD)
  1529.                 Else
  1530.                     nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTEREDADAPTERSPATH,"UseDomainNameDevolution",0,CONST_DWORD)
  1531.                 End if
  1532.                 
  1533.                 If  Err.number <> 0 or nretval= FALSE Then
  1534.                     SA_SetErrMsg L_ERROR_IN_UPDATINGDNSSUFFIXES_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1535.                     Exit Function
  1536.                 End If    
  1537.             End If    
  1538.         End If
  1539.                     
  1540.         'Release objects
  1541.         Set objNetWorkAdCon  = nothing    
  1542.         
  1543.         SetDNSResolutionSettings = True
  1544.                 
  1545.     End Function        
  1546.     
  1547.     '-------------------------------------------------------------------------
  1548.     'Function name:        OutputDNSSUffixesToFormOptions()
  1549.     'Description:        Serves in displaying the DNS domains in the list box.
  1550.     'Input Variables:    None    
  1551.     'Output Variables:    None
  1552.     'Returns:            None
  1553.     'Global Variables:    In:G_objService - WMI server object
  1554.     '                    In:F_strDNSSuffixesChecked - value of specific DNS suffixes Radio button    
  1555.     '                    In:F_nNICIndex - instance of Win32_NetworkAdapterConfiguration for which IP enabled .        
  1556.     '                    In:L_(*)-Localized strings
  1557.     '-------------------------------------------------------------------------            
  1558.     Function OutputDNSSUffixesToFormOptions()
  1559.         
  1560.         Err.Clear 
  1561.         On Error Resume Next
  1562.         
  1563.         Dim objAllNICInstances        
  1564.         Dim strSuffix
  1565.         Dim nlowerbound,nupperbound,index
  1566.         Dim arrDNSSuffixes
  1567.         
  1568.         If not F_strDNSSuffixes = "" Then
  1569.             'Splitting the concatenated string into an array of DNS
  1570.             arrDNSSuffixes = Split(F_strDNSSuffixes, Chr(1),-1,0)
  1571.             'Displaying DNS Suffixes from form                    
  1572.             If UCase(G_SpecificChecked)="CHECKED" Then                    
  1573.                 For index = 0 to ubound(arrDNSSuffixes)
  1574.                     'Writing the DNS Suffixes into the list box.
  1575.                     Response.Write "<OPTION VALUE='" & Server.HTMLEncode(arrDNSSuffixes(index)) & "' >" & Server.HTMLEncode(arrDNSSuffixes(index)) & "</OPTION>"
  1576.                 Next
  1577.             End if
  1578.         Else
  1579.             Set G_objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1580.         
  1581.             'Getting the Win32_NetworkAdapterConfiguration for the NIC index for which IP is enabled.
  1582.             Set objAllNICInstances = getNetworkAdapterObject(G_objService,F_nNICIndex)
  1583.                             
  1584.             'DNS domain suffixes     
  1585.             If (IsNull(objAllNICInstances.DNSDomainSuffixSearchOrder) ) Then
  1586.             Else
  1587.                 nlowerbound = LBound(objAllNICInstances.DNSDomainSuffixSearchOrder)
  1588.                 nupperbound = UBound(objAllNICInstances.DNSDomainSuffixSearchOrder)
  1589.             End if        
  1590.             
  1591.             If nupperbound >= 20 then
  1592.                 nupperbound = MAX_DNS_SUFFIXES
  1593.             End If    
  1594.         
  1595.             'Displaying DNS Suffixes from system                    
  1596.             If UCase(G_SpecificChecked)="CHECKED" Then                    
  1597.                 For index = nlowerbound to nupperbound
  1598.                     strSuffix = objAllNICInstances.DNSDomainSuffixSearchOrder(index)
  1599.                     'Writing the DNS Suffixes into the list box.
  1600.                     Response.Write "<OPTION VALUE='" & Server.HTMLEncode(SA_EscapeQuotes(strSuffix)) & "' >" & Server.HTMLEncode(strSuffix) & "</OPTION>"
  1601.                 Next
  1602.             End if
  1603.         End If    
  1604.         
  1605.     End Function    
  1606.     
  1607.     '-------------------------------------------------------------------------
  1608.     'Function:                SetTCPHostsData()
  1609.     'Description:            serves to set the contents to TCP hosts file
  1610.     'Input Variables:        None
  1611.     'Output Variables:        None
  1612.     'Returns:                None
  1613.     'Global Variables:        F_strTCPHostData
  1614.     '-------------------------------------------------------------------------
  1615.  
  1616.     Function SetTCPHostsData()
  1617.  
  1618.         On Error Resume Next
  1619.         Err.Clear
  1620.     
  1621.         Dim objFileSystem    'Creating file system object
  1622.         Dim objFile            'Instance of file system object
  1623.         Dim strTCPHostsFile    'TCP/IP Hosts File path
  1624.         
  1625.         SetTCPHostsData = false
  1626.         
  1627.         'Get TCP/IP Hosts File path
  1628.         strTCPHostsFile = GetSystemPath & "\drivers\etc\hosts"
  1629.         
  1630.         'Creating file system object
  1631.         Set objFileSystem= Server.CreateObject("Scripting.FileSystemObject")
  1632.         
  1633.         'Error in creating file system object
  1634.         If  Err.number <> 0 Then
  1635.             SA_SetErrMsg L_ERROR_IN_CREATING_SCRIPTING_FILESYSTEMOBJECT_ERRORMESSAGE & "(" & Hex(Err.Number) & ")" 
  1636.             Exit Function
  1637.         End If    
  1638.         
  1639.         'Open the TCP/IP Hosts file
  1640.         Set objFile=objFileSystem.OpenTextFile(strTCPHostsFile,2,True)
  1641.         
  1642.         'Update/Write into the TCP/IP Hosts file
  1643.         objFile.write(F_strTCPHostData)
  1644.         objFile.close
  1645.             
  1646.         'Release object
  1647.         Set objFile = Nothing
  1648.         Set objFileSystem=Nothing
  1649.         
  1650.         SetTCPHostsData = True
  1651.         
  1652.     End Function    
  1653.     
  1654.     '-------------------------------------------------------------------------
  1655.     'Function:                GetSystemPath()
  1656.     'Description:            To get the Operating System path
  1657.     'Input Variables:        None
  1658.     'Output Variables:        None
  1659.     'Returns:                Operating system path
  1660.     'Global Variables:        None
  1661.     '-------------------------------------------------------------------------
  1662.  
  1663.     Function GetSystemPath()
  1664.     
  1665.         On Error Resume Next
  1666.         Err.Clear
  1667.     
  1668.         Dim objOS            'Create instance of Win32_OperatingSystem
  1669.         Dim objOSInstance    
  1670.         Dim strSystemPath    'OS path
  1671.         Dim objConnection    'Connection to WMI
  1672.         Dim strQuery        'Query string
  1673.             
  1674.         strQuery = "Select * from Win32_OperatingSystem"
  1675.         
  1676.         'Connection to WMI
  1677.         set objConnection = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1678.         
  1679.         'Error message incase faield to connect to WMI
  1680.         If Err.number<>0 then 
  1681.             Call SA_ServeFailurePageEx(L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE, mstrReturnURL)
  1682.             GetSystemPath=""
  1683.             Exit Function
  1684.         End if
  1685.         
  1686.         'Execute Query
  1687.         Set objOS = objConnection.ExecQuery(strQuery)
  1688.         
  1689.         'Get OS installed path
  1690.         For Each objOSInstance in objOS
  1691.             strSystemPath = objOSInstance.SystemDirectory
  1692.         Next 
  1693.         
  1694.         Set objOS = Nothing
  1695.         Set objOSInstance = Nothing
  1696.         Set objConnection = Nothing
  1697.         
  1698.         GetSystemPath = strSystemPath
  1699.     
  1700.     End Function
  1701.     
  1702.     '-------------------------------------------------------------------------
  1703.     'Function:                RegistryConnection()
  1704.     'Description:            Sets G_objRegistry to the RegConnection function
  1705.     'Input Variables:        None
  1706.     'Output Variables:        None
  1707.     'Returns:                None
  1708.     'Global Variables:        G_objRegistry
  1709.     '-------------------------------------------------------------------------
  1710.     Function RegistryConnection()
  1711.         
  1712.         On Error Resume Next
  1713.         Err.Clear
  1714.         
  1715.         'Getting registry conection
  1716.         Set G_objRegistry = RegConnection()
  1717.                 
  1718.         'Checking for the object
  1719.         If (G_objRegistry is Nothing) Then
  1720.             Call SA_PageEx(L_SERVERCONNECTIONFAIL_ERRORMESSAGE, mstrReturnURL)
  1721.             Exit Function
  1722.         End If
  1723.         
  1724.     End Function
  1725.     
  1726. %>
  1727.  
  1728.  
  1729.